package com.shuai.AI.builder_test;

/**
 * @author : 帅宏-coding
 * @version : 1.0
 * @date : 2025/9/26 0026
 */
public class ExportToolDemo {

  private final int code;
  private final String message;

  private ExportToolDemo(int code, String message) {
    this.code = code;
    this.message = message;
  }

  // 创建Builder
  public static Builder builder() {
    return new Builder();
  }

  // 定义Builder类
  public static class Builder {
    private int code;
    private String message;

    public Builder setCode(int code) {
      this.code = code;
      return this;
    }

    public Builder setMessage(String message) {
      this.message = message;
      return this;
    }

    public ExportToolDemo build() {
      return new ExportToolDemo(code, message);
    }
  }

  public int getCode() {
    return code;
  }

  public String getMessage() {
    return message;
  }

  public String toString() {
    return "ExportToolDemo{" + "code=" + code + ", message='" + message + '\'' + '}';
  }

  public static void main(String[] args) {
    ExportToolDemo exportToolDemo = ExportToolDemo.builder().setCode(200).setMessage("成功").build();
    System.out.println(exportToolDemo.getCode());
    System.out.println(exportToolDemo.getMessage());
    System.out.println(exportToolDemo);
  }
}
